import Vue from 'vue';
import VueRouter from 'vue-router';
import App from './components/app.vue';
import header from './components/header.vue';
import footer from './components/footer.vue';
import Music from './components/music.vue';
import Oumei from './components/oumei.vue';
import Guochan from './components/guochan.vue';

// 注册全局组件
Vue.component('headerVue', header);
Vue.component('footerVue', footer);

// 安装插件 挂载属性
Vue.use(VueRouter); 

// 创建路由对象并配置路由规则
let router = new VueRouter({
    routes:[
        {path: '/',redirect: {name:'music'}},
        {name:'music',
         path: '/music',
         component:Music,
         children:[
            //  路径写上斜杠那么找的就是绝对路径，如果没有那么就是相对路径
            //  相对于music的的路径 例： music/oumei
            { name: 'music_oumei',path: 'oumei',component: Oumei},
            { name: 'music_guochan',path: 'guochan',component: Guochan}
        ]}
    ]
})
// new Vue 启动
new Vue({
    el: '#app',
    router,  // 路由
    render: c => c(App)
})